package edu.suda.xsap.service.impl;


import edu.suda.xsap.dto.Statistics_customerDto;
import edu.suda.xsap.dto.convert.Statistics_customerConvert;
import edu.suda.xsap.entity.Statistics_customer;
import edu.suda.xsap.mapper.Statistics_customerMapper;
import edu.suda.xsap.service.Statistics_customerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.Year;
import java.util.List;

@Service
public class Statistics_customerServiceImpl implements Statistics_customerService {

    @Autowired
    private Statistics_customerConvert statistics_customerConvert;

    @Autowired
    private Statistics_customerMapper statistics_customerMapper;

    @Override
    public List<Statistics_customerDto> findMONTH(Year year) {
        //
        List<Statistics_customer> statistics_customers = statistics_customerMapper.findMONTH(year);
        //要把这个List<s_c>转换成List<s_cDto>
        return statistics_customerConvert.toDtoList(statistics_customers);
    }

    @Override
    public List<Statistics_customerDto> findYEAR(Year year1, Year year2) {
        //
        List<Statistics_customer> statistics_customers = statistics_customerMapper.findYEAR(year1,year2);
        //要把这个List<s_c>转换成List<s_cDto>
        return statistics_customerConvert.toDtoList(statistics_customers);
    }

    @Override
    public List<Statistics_customerDto> findQUARTER(Year year) {
        //
        List<Statistics_customer> statistics_customers = statistics_customerMapper.findQUARTER(year);
        //要把这个List<s_c>转换成List<s_cDto>
        return statistics_customerConvert.toDtoList(statistics_customers);
    }
}
